import Ciallo from "@/api/Ciallo";
// 
export default function Ciallo4API(Mode) {
    const datas = arguments
    const urls = [
        "/s_directoryListAll",//查内容
        "/adds_directory",//增
        "/updates_directory",//改
        "/deletes_directory",//删
        "/parent_directory",//查1
        "/second_directory", //查2
        "/getParentBySid",//查3
    ]
    const fns = {
        "/s_directoryListAll": new Map([["page", datas[1]], ["limit", datas[2]], ["name", datas[3]]]),//查
        "/adds_directory": new Map([["sid", datas[1]], ["title", datas[2]], ["link", datas[3]]]),//增
        "/updates_directory": new Map([["id", datas[1]], ["sid", datas[2]], ["title", datas[3]], ["link", datas[4]]]),//改
        "/deletes_directory": new Map([["ids", datas[1]]]),//删    
        "/parent_directory": new Map([]),//查1
        "/second_directory": new Map([["pid", datas[1]]]),
        "/getParentBySid":new Map([["sid",datas[1]]])
    }

    const url = urls[Mode]
    const data = {}
    fns[url].forEach((k, v) => { Reflect.set(data, v, k) })
    // console.log(url,data)
    const method = Mode == 4 ? "get" : "post"
    return Ciallo({
        url: url,
        method: method,
        params: { ...data }
    })
}